package com.kuang.springcloud.controller;

import com.kuang.springcloud.service.DeptService;
import com.kuang.srpingcloud.api.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//提供restful服务
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @RequestMapping("/add")
    public boolean add(Dept dept){
        return deptService.add(dept);
    }
    @GetMapping("/queryByID/{id}")
    public Dept queryByID(@PathVariable("id") Long id){
        return deptService.queryByID(id);
    }
    @GetMapping("/queryAll")
    public List<Dept> queryAll() {
        return deptService.queryAll();
    }
}
